/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.nju.software.greencreditsystem.factory;

import cn.edu.nju.software.greencreditsystem.service.BankLoginService;
import cn.edu.nju.software.greencreditsystem.service.ConfigService;
import cn.edu.nju.software.greencreditsystem.service.EnterpriseService;
import cn.edu.nju.software.greencreditsystem.service.EnterpriseTypeService;
import cn.edu.nju.software.greencreditsystem.service.EnvironmentExcelService;
import cn.edu.nju.software.greencreditsystem.service.EnvironmentService;
import cn.edu.nju.software.greencreditsystem.service.FinancialExcelService;
import cn.edu.nju.software.greencreditsystem.service.FinancialService;
import cn.edu.nju.software.greencreditsystem.service.PredictionService;
import cn.edu.nju.software.greencreditsystem.service.RepaymentRecordService;
import cn.edu.nju.software.greencreditsystem.service.WarningService;

/**
 * 作者：韩天
 * 创建时间：2011-8-2
 * 类描述：返回相应的Service实例的工厂
 */
public class ServiceFactory {
    private static EnterpriseService us = null;//EnterpriseService的单例
    private static EnterpriseTypeService ets = null;//EnterpriseTypeService的单例
    private static RepaymentRecordService rrs = null;//RepaymentRecordService的单例
    private static FinancialExcelService fes = null;//FinancialExcelService的单例
    private static EnvironmentExcelService ees = null;//EnvironmentExcelService的单例
    private static FinancialService fs = null;//FinancialService的单例
    private static EnvironmentService es = null;//EnvironmentService的单例
    private static WarningService ws = null;//WarningService的单例
    private static PredictionService ps = null;//PredictionService单例
    private static ConfigService cs = null;//ConfigService的单例
    private static BankLoginService bls = null;//BankLoginService的单例
    
    /**
     * 方法描述：取得EnterpriseService的实例方法
     * param：
     * return：us——EnterpriseService的单例
    */
    public static EnterpriseService getEnterpriseServiceInstance(){
        if(us == null)  us = new EnterpriseService();
        return us;
    }
    
    /**
     * 方法描述：取得EnterpriseTypeService的实例方法
     * param：
     * return：ets——EnterpriseTypeService的单例
    */
    public static EnterpriseTypeService getEnterpriseTypeServiceInstance(){
        if(ets == null)  ets = new EnterpriseTypeService();
        return ets;
    }
    
    /**
     * 方法描述：取得RepaymentRecordService的实例方法
     * param：
     * return：rrs——RepaymentRecordService的单例
    */
    public static RepaymentRecordService getRepaymentRecordServiceInstance(){
        if(rrs == null)  rrs = new RepaymentRecordService();
        return rrs;
    }
    
    /**
     * 方法描述：取得FinancialExcelService的单例
     * param：
     * return：fes——FinancialExcelService的单例
    */
    public static FinancialExcelService getFinancialExcelServiceInstance(){
        if(fes == null)  fes = new FinancialExcelService();
        return fes;
    }
    
    /**
     * 方法描述：取得EnvironmentExcelService的单例
     * param：
     * return：ees——EnvironmentExcelService的单例
    */
    public static EnvironmentExcelService getEnvironmentExcelServiceInstance(){
        if(ees == null)  ees = new EnvironmentExcelService();
        return ees;
    }
    
    /**
     * 方法描述：取得FinancialService的单例
     * param：
     * return：fs——FinancialService的单例
    */
    public static FinancialService getFinancialServiceInstance(){
        if(fs == null)  fs = new FinancialService();
        return fs;
    }
    
    /**
     * 方法描述：取得EnvironmentService的单例
     * param：
     * return：es——EnvironmentService的单例
    */
    public static EnvironmentService getEnvironmentServiceInstance(){
        if(es == null)  es = new EnvironmentService();
        return es;
    }
    
    /**
     * 方法描述：取得WarningService的单例
     * param：
     * return：ws——WarningService的单例
    */
    public static WarningService getWarningServiceInstance(){
        if(ws == null)  ws = new WarningService();
        return ws;
    }
    
    /**
     * 方法描述：取得PredictionService的单例
     * param：
     * return：ps——PredictionService的单例
    */
    public static PredictionService getPredictionServiceInstance(){
        if(ps == null)  ps = new PredictionService();
        return ps;
    }
    
    /**
     * 方法描述：取得ConfigService的单例
     * param：
     * return：cs——ConfigService的单例
    */
    public static ConfigService getConfigServiceInstance(){
        if(cs == null)  cs = new ConfigService();
        return cs;
    }
    
    /**
     * 方法描述：取得BankLoginService的单例
     * param：
     * return：bls——BankLoginService的单例
    */
    public static BankLoginService getBankLoginServiceInstance(){
        if(bls == null)  bls = new BankLoginService();
        return bls;
    }
}
